﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Hiver.Entity;

namespace Hiver.Business
{
    /// <summary>
    /// 用户服务接口
    /// </summary>
    public interface IUserService
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        UserInfo Login(string userName, string password);

        /// <summary>
        /// 获得数据分页
        /// </summary>
        /// <param name="query"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        List<UserInfo> GetSearchPageList(Expression<Func<UserInfo, bool>> query, int pageIndex, int pageSize);

        /// <summary>
        /// 获得用户数据（分页）
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        List<UserInfo> GetPageList(int pageIndex, int pageSize);

        /// <summary>
        /// 获得所有用户数据
        /// </summary>
        /// <returns></returns>
        List<UserInfo> GetList();

        /// <summary>
        /// 通过主键获得用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        UserInfo Get(int id);

        /// <summary>
        /// 添加用户信息，并返回插入的id
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        int Add(UserInfo entity);

        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool Update(UserInfo entity);

        /// <summary>
        /// 删除用户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool Del(int id);

        /// <summary>
        /// 批量删除用户信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        bool Dels(dynamic[] ids);
    }
}